package net.xuele.learn.pic;

import java.util.concurrent.CountDownLatch;

public class TestAdd10K {

    public static void main(String[] args) throws InterruptedException {
        CountDownLatch countDownLatch = new CountDownLatch(1);
        Add10K add10K = new Add10K();
        for (int i = 0; i < 2; i++) {
            new Thread(() -> {
                try {
                    countDownLatch.await();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                add10K.add10K();
            }, "Thread-" + i).start();
        }
        countDownLatch.countDown();

        Thread.sleep(1000);

        System.out.println(add10K.get());

    }
}
